home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / network / ka9q / ka9q_src.arc / NETROM.H < prev    next >
C/C++ Source or Header  |  1988-11-29  |  5KB  |  156 lines

  1. /* cat > ./netrom.h << '\Rogue\Monster\' */
  2. /* net/rom support definitions */
  3.  
  4. #define NR3HLEN        15        /* length of a net/rom level 3 hdr, */
  5. #define NR3DLEN        241        /* max data size in net/rom l3 packet */
  6. #define NR3NODESIG    0xff        /* signature for nodes broadcast */
  7. #define NR3NODEHL    7        /* nodes bc header length */
  8.  
  9. #define NRNUMIFACE    10        /* number of interfaces associated */
  10.                     /* with net/rom network layer      */
  11. #define NRNUMCHAINS    17        /* number of chains in the */
  12.                     /* neighbor and route hash tables */
  13. #define NRRTDESTLEN    21        /* length of destination entry in */
  14.                     /* nodes broadcast */
  15. #define NRDESTPERPACK    11        /* maximum number of destinations per */
  16.                     /* nodes packet */
  17.  
  18. /* Internal representation of net/rom network layer header */
  19. struct nr3hdr {
  20.     struct ax25_addr source ;        /* callsign of origin node */
  21.     struct ax25_addr dest ;            /* callsign of destination node */
  22.     unsigned ttl ;                /* time-to-live */
  23. } ;
  24.  
  25. /* Internal representation of net/rom routing broadcast destination */
  26. /* entry */
  27. struct nr3dest {
  28.     struct ax25_addr dest ;            /* destination callsign */
  29.     char alias[7] ;                /* ident, upper case ASCII, blank-filled */
  30.     struct ax25_addr neighbor ;        /* best-quality neighbor */
  31.     unsigned quality ;            /* quality of route for this neighbor */
  32. } ;
  33.  
  34.  
  35. /* net/rom interface table entry */
  36. struct nriface {
  37.     struct interface *interface ;    /* pointer to ax.25 interface */
  38.     char alias[7] ;                    /* alias for this interface's node */
  39.                                     /* broadcasts */
  40.     unsigned quality ;                /* net/rom link quality estimate */
  41. } ;
  42.  
  43. /* net/rom neighbor table structure */
  44. struct nrnbr_tab {
  45.     struct nrnbr_tab *next ;        /* doubly linked list pointers */
  46.     struct nrnbr_tab *prev ;
  47.     char call[AXALEN*3] ;            /* call of neighbor + 2 digis max */
  48.     unsigned interface ;            /* offset of neighbor's port in */
  49.                                     /* interface table */
  50.     unsigned refcnt ;                /* how many routes for this neighbor? */
  51. } ;
  52.  
  53. #define    NULLNTAB    (struct nrnbr_tab *)0
  54.  
  55.  
  56. /* A list of these structures is provided for each route table */
  57. /* entry.  They bind a destination to a neighbor node.  If the */
  58. /* list of bindings becomes empty, the route table entry is    */
  59. /* automatically deleted.                   */
  60.  
  61. struct nr_bind {
  62.     struct nr_bind *next ;        /* doubly linked list */
  63.     struct nr_bind *prev ;
  64.     unsigned quality ;        /* quality estimate */
  65.     unsigned obsocnt ;        /* obsolescence count */
  66.     unsigned flags ;
  67. #define    NRB_PERMANENT    0x01    /* entry never times out */
  68.     struct nrnbr_tab *via ;        /* route goes via this neighbor */
  69. } ;
  70.  
  71. #define    NULLNRBIND    (struct nr_bind *)0
  72.  
  73.  
  74. /* net/rom routing table entry */
  75.  
  76. struct nrroute_tab {
  77.     struct nrroute_tab *next ;        /* doubly linked list pointers */
  78.     struct nrroute_tab *prev ;
  79.     char alias[7] ;                /* alias of node */
  80.     struct ax25_addr call ;            /* callsign of node */
  81.     unsigned num_routes ;            /* how many routes in bindings list? */
  82.     struct nr_bind *routes ;        /* list of neighbors */
  83.  
  84. } ;
  85.  
  86. #define    NULLNRRTAB    (struct nrroute_tab *)0
  87.  
  88.  
  89. /* The net/rom nodes broadcast filter structure */
  90. struct nrnf_tab {
  91.     struct nrnf_tab *next ;            /* doubly linked list */
  92.     struct nrnf_tab *prev ;
  93.     struct ax25_addr neighbor ;        /* call of neighbor to filter */
  94.     unsigned interface ;            /* filter on this interface */
  95. } ;
  96.  
  97. #define    NULLNRNFTAB    (struct nrnf_tab *)0
  98.  
  99.  
  100. /* The interface table */
  101. extern struct nriface nrifaces[NRNUMIFACE] ;
  102.  
  103. /* How many interfaces are in use */
  104. extern unsigned nr_numiface ;
  105.  
  106. /* The neighbor hash table (hashed on neighbor callsign) */
  107. extern struct nrnbr_tab *nrnbr_tab[NRNUMCHAINS] ;
  108.  
  109. /* The routes hash table (hashed on destination callsign) */
  110. extern struct nrroute_tab *nrroute_tab[NRNUMCHAINS] ;
  111.  
  112. /* The nodes broadcast filter table */
  113. extern struct nrnf_tab *nrnf_tab[NRNUMCHAINS] ;
  114.  
  115. /* filter modes: */
  116. #define    NRNF_NOFILTER    0        /* don't filter */
  117. #define    NRNF_ACCEPT        1        /* accept broadcasts from stations in list */
  118. #define    NRNF_REJECT        2        /* reject broadcasts from stations in list */
  119.  
  120. /* The filter mode */
  121. extern unsigned nr_nfmode ;
  122.  
  123. /* The time-to-live for net/rom network layer packets */
  124. extern unsigned nr_ttl ;
  125.  
  126. /* The obsolescence count initializer */
  127. extern unsigned obso_init ;
  128.  
  129. /* The threshhold at which routes becoming obsolete are not broadcast */
  130. extern unsigned obso_minbc ;
  131.  
  132. /* The quality threshhold below which routes in a broadcast will */
  133. /* be ignored */
  134. extern unsigned nr_autofloor ;
  135.  
  136. /* The maximum number of routes maintained for a destination. */
  137. /* If the list fills up, only the highest quality routes are  */
  138. /* kept.  This limiting is done to avoid possible over-use of */
  139. /* memory for routing tables in closely spaced net/rom networks. */
  140. extern unsigned nr_maxroutes ;
  141.  
  142. /* The netrom pseudo-interface */
  143. extern struct interface *nr_interface ;
  144.  
  145. /* Functions */
  146. extern struct nrroute_tab *find_nrroute() ;
  147. extern struct nrnbr_tab *find_nrnbr() ;
  148. extern struct nrnf_tab *find_nrnf() ;
  149. extern int nr_routeadd();
  150. extern int nr_routedrop() ;
  151. extern int nr_nfadd();
  152. extern int nr_nfdrop() ;
  153. extern char *nr_getroute() ;
  154. extern int ntohnrdest() ;
  155. extern struct mbuf *htonnrdest() ;
  156.